<?php if( ! defined('BASEPATH')) exit('No direct script access allowed');

class Engineer_model extends CI_Model
{
	public function delete_engineer($id)
	{

		return $this->db->delete('users', array('id' => $id));
	}
	
	function view()
	{	

	   $this->datatables
			->select("users.id as id ,users.first_name,users.last_name,users.company,users.email,users.phone")
			->from('users','users_groups')
			->join('users_groups','users.id=users_groups.user_id')
			->where('users_groups.group_id',2)
			->add_column("Actions", 
			"<center>			<a href='index.php/admin/engineer/edit_engineer/$1'>
			
								<i class='icon-edit ' title='Edit'></i>
								</a>
							    <a href='index.php/admin/engineer/delete_engineer/$1' onClick=\"return confirm('". $this->lang->line('alert_x_customer') ."')\">
								<i class='icon-trash ' title='Delete'></i>
								</a></center>", "id")
			->unset_column('id');
			
	   return  $this->datatables->generate();
			
	}
}